package com.cosina.game.tetri.engine;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import com.cosina.game.tetri.engine.impl.shape.DeZShape;
import com.cosina.game.tetri.engine.impl.shape.HillShape;
import com.cosina.game.tetri.engine.impl.shape.LongShape;
import com.cosina.game.tetri.engine.impl.shape.SquareShapeImpl;
import com.cosina.game.tetri.engine.impl.shape.ZShape;

public class ShapeFactory {
	private static List<Class<? extends Shape>> shapes = new ArrayList<Class<? extends Shape>>();
	static {
		shapes.add(LongShape.class);
		shapes.add(DeZShape.class);
		shapes.add(ZShape.class);
		shapes.add(SquareShapeImpl.class);
		shapes.add(HillShape.class);
		
		shapes.add(DeZShape.class);
		shapes.add(ZShape.class);
		shapes.add(SquareShapeImpl.class);
		shapes.add(HillShape.class);
	}
	
	private static Random random = new Random();
	public static Shape getRandom(){
		try {
			return shapes.get(random.nextInt(shapes.size())).newInstance();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		}
		return null;
	}
}
